<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>商品退货管理</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta http-equiv="Access-Control-Allow-Origin" content="*">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="format-detection" content="telephone=no">
<link rel="icon" href="/favicon.ico">
<link rel="stylesheet" href="/resources/layui/css/layui.css" media="all" />
<link rel="stylesheet" href="/resources/css/public.css" media="all" />

</head>
<body class="childrenBody">
<!-- 查询条件开始 -->
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 5px;">
  <legend>查询条件</legend>
</fieldset>
<blockquote class="layui-elem-quote">
	<form action="" method="post" id="searchFrm" lay-filter="searchFrm" class="layui-form layui-form-pane">
		<div class="layui-form-item">
		   <div class="layui-inline">
		       <label class="layui-form-label">供应商</label>
		       <div class="layui-input-inline">
		         <select name="providerid" id="search_providerid">
		         	<option value="0">请选择供应商</option>
		         </select>
		      </div>
		    </div>
		   <div class="layui-inline">
		       <label class="layui-form-label">商品名称</label>
		       <div class="layui-input-inline">
		         <select name="goodsid" id="search_goodsid">
		         	<option value="0">请选择商品</option>
		         </select>
		      </div>
		    </div>
		    <div class="layui-inline">
		       <label class="layui-form-label">开始时间</label>
		       <div class="layui-input-inline">
		          <input type="text" name="startTime" readonly="readonly"  id="startTime" autocomplete="off" class="layui-input">
		      </div>
		    </div>
		   </div>
		  <div class="layui-form-item">
		   <div class="layui-inline">
		       <label class="layui-form-label">操作员</label>
		       <div class="layui-input-inline">
		          <input type="text" name="operateperson"  autocomplete="off" class="layui-input">
		      </div>
		    </div>
		   <div class="layui-inline">
		       <label class="layui-form-label">备注</label>
		       <div class="layui-input-inline">
		          <input type="text" name="remark"  autocomplete="off" class="layui-input">
		      </div>
		    </div>
		    <div class="layui-inline">
		      <label class="layui-form-label">结束时间</label>
		      <div class="layui-input-inline">
		        <input type="text"  name="endTime" readonly="readonly"  id="endTime"  autocomplete="off" class="layui-input">
		      </div>
		    </div>
		  </div>
		  <div class="layui-form-item">
		  	 <div class="layui-input-block" style="text-align: center;">
		       	<button type="button" class="layui-btn" lay-submit="" lay-filter="doSearch"><span class="layui-icon layui-icon-search"></span>查询</button>
      			<button type="reset" class="layui-btn layui-btn-warm"><span class="layui-icon layui-icon-refresh-1"></span>重置</button>
		      </div>
		  </div>
	</form>
</blockquote>
<!-- 查询条件结束-->


<!-- 数据表格开始 -->
<div>
	<table class="layui-hide" id="outportTable" lay-filter="outportTable"></table>
</div>

<!-- 数据表格结束 -->

<script type="text/javascript" src="/resources/layui/layui.js"></script>
<script type="text/javascript">
var tableIns;
layui.use(['jquery','form','table','layer','laydate'],function(){
		var $=layui.jquery;
		var form=layui.form;
		var table=layui.table;
		var layer=layui.layer;
		var laydate=layui.laydate;
		//渲染时间选择器
		laydate.render({
			elem:'#startTime',
			type:'datetime'
		});
		laydate.render({
			elem:'#endTime',
			type:'datetime'
		});
		
		//加载 数据
		 tableIns=table.render({
			 elem: '#outportTable'
		    ,url:'/outport/loadAllOutport'
		    ,toolbar: true //开启头部工具栏，并为其绑定左侧模板
		    ,title: '商品退货数据表'
		    ,height:'full-280'
		    ,page: true
		    ,cols: [ [
		      {field:'id', title:'退货ID',align:'center' }
		      ,{field:'providername', title:'供应商',align:'center'}
		      ,{field:'goodsname', title:'商品名称',align:'center'}
		      ,{field:'size', title:'商品规格',align:'center'}
		      ,{field:'outputtime', title:'退货时间',align:'center'}
		      ,{field:'number', title:'退货数量',align:'center'}
		      ,{field:'outportprice', title:'退货价格',align:'center'}
		      ,{field:'remark', title:'备注',align:'center'}
		      ,{field:'operateperson', title:'操作员',align:'center'}
		    ] ]
		});
		
		//加载查询条件供应商的下拉列表
		$.get("/provider/loadAllProviderForSelect",function(res){
				var data=res.data;
				var dom=$("#search_providerid");
				var html='<option value="0">请选择供应商</option>'
				$.each(data,function(index,item){
					html+='<option value="'+item.id+'">'+item.providername+'</option>'
				});
				dom.html(html);
				form.render("select");
			});
		$.get("/goods/loadAllGoodsForSelect",function(res){
				var data=res.data;
				var dom=$("#search_goodsid");
				var html='<option value="0">请选择商品</option>'
				$.each(data,function(index,item){
					html+='<option value="'+item.id+'">'+item.goodsname+'-'+item.size+'['+item.providername+']</option>'
				});
				dom.html(html);
				form.render("select");
			});
		
		//模糊查询
		form.on("submit(doSearch)",function(data){
			tableIns.reload({
				where:data.field,
				page:{
					curr:1
				}
			});
			return false;
		});
	});
</script>

</body>
</html>